package com.nf.health.app.healthbank;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.LinearLayout;

import com.nf.health.app.R;
import com.nf.health.app.utils.ScreentUtils;


/**
 * Created by hepann on 2016/10/8.
 * The only genius that is worth anything is the genius for hard work
 *
 * @author hepann
 * @Description 问诊界面点击问号时提示, 加载webview
 * @email he_pann@163.com
 */
public class HealthBankHintDialog extends Dialog {

    private Context ctx;
    private Button btnIKnow;
    private WebView wv;
    private View mContent;

    public HealthBankHintDialog(Context context) {
        //设置style
        super(context, R.style.dialog);
        this.ctx = context;
        init();
    }

    //设置布局
    private void init() {
        setContentView(R.layout.dialog_inquiry_hint);
        btnIKnow = (Button) findViewById(R.id.btn_i_know);
        wv = (WebView) findViewById(R.id.wv_msg);
        mContent = findViewById(R.id.ll_content);

        //设置大小
        LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) mContent.getLayoutParams();
        p.width = (int) (ScreentUtils.getScreenWidth(ctx) * .8);
        p.height = (int) (ScreentUtils.getScreenHeight(ctx) * .5);
        mContent.setLayoutParams(p);
        //监听
        btnIKnow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

    @Override
    protected void onStart() {
        super.onStart();
        getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        initData();
    }

    private void initData() {
        String url = "<font>dsada<font>";
        wv.loadDataWithBaseURL(null, url, "text/html", "UTF-8", null);
    }

}
